package com.yitao.cms.enums;

import com.yitao.client.constant.ProductConstant;
import com.yitao.client.dto.enums.EnumDto;
import org.apache.commons.lang.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: wwl
 * @Date: 2019/4/10 15:24
 * @Description:
 */
public class OverseasLogisticsEnums {
    //入库状态
    public enum p2Status{
        FORECAST_NO(-2,"待预报"),
        FORECAST_SUCCESS(-1,"预报成功"),
        NO_REPORT_STOCK(0,"未预报已入库"),
        REPORT_NO_STOCK(1,"预报的未入库"),
        REPORT_STOCK(2,"已预报已入库"),
        STOCK_EXCEPTION(3,"入库异常");

        private Integer code;
        private String desc;
        private static final Map<String, String> map = new HashMap<>();

        p2Status(Integer code,String desc){
            this.code = code;
            this.desc = desc;
        }

        static {
            for(OverseasLogisticsEnums.p2Status p2Status1: OverseasLogisticsEnums.p2Status.values()){
                map.put(p2Status1.getCode().toString(), p2Status1.getDesc());
            }
        }

        public Integer getCode() {
            return code;
        }


        public String getDesc() {
            return desc;
        }

        public static String getDescByCode(Integer Code){
            for (OverseasLogisticsEnums.p2Status e : OverseasLogisticsEnums.p2Status.values()) {
                if (e.getCode() .equals(Code) ){
                    return e.getDesc();
                }
            }
            return null;
        }
        //枚举列表
        public static List<EnumDto> getP2StatusEnum(){
            List<EnumDto> list = new ArrayList<>();
            for (OverseasLogisticsEnums.p2Status e : OverseasLogisticsEnums.p2Status.values()){
                EnumDto enumDto = new EnumDto();
                enumDto.setCode(e.getCode());
                enumDto.setDesc(e.getDesc());
                list.add(enumDto);
            }
            return list;
        }

        public static String getMsgByCode(String code){
            return map.get(code);
        }

    }
    //发货状态
    public enum p4Status{
        NO_STOCK(-2,"待通知发货"),
        STOCK_SUCCESS(-1,"通知发货成功"),
        NO_OUT_STOCK(0,"未出库"),
        SEND_INLAND(1,"发往国内"),
        SUBMIT_AIRWAY(2,"发往航空公司"),
        ARRIVE_INLAND(3,"抵达国内"),
        CHANGE_KEMS(4,"已转国内快递"),
        USER_SIGN(5,"用户签收");

        private Integer code;
        private String desc;

        p4Status(Integer code,String desc){
            this.code = code;
            this.desc = desc;
        }

        public Integer getCode() {
            return code;
        }


        public String getDesc() {
            return desc;
        }

        public static String getDescByCode(Integer Code){
            for (OverseasLogisticsEnums.p4Status e : OverseasLogisticsEnums.p4Status.values()) {
                if (e.getCode() .equals(Code) ){
                    return e.getDesc();
                }
            }
            return null;
        }
        //枚举列表
        public static List<EnumDto> getP4StatusEnum(){
            List<EnumDto> list = new ArrayList<>();
            for (OverseasLogisticsEnums.p4Status e : OverseasLogisticsEnums.p4Status.values()){
                EnumDto enumDto = new EnumDto();
                enumDto.setCode(e.getCode());
                enumDto.setDesc(e.getDesc());
                list.add(enumDto);
            }
            return list;
        }

    }

    /**
     * P2接口异常信息表异常信息来源状态值
     */
    public enum STATUS_ERROR{
        NO_PUSH(0, "没有推送预报"),
        NO_EXIST(1, "没有导入到境外物流信息表")
        ;

        private Integer code;
        private String desc;

        STATUS_ERROR(Integer code,String desc){
            this.code = code;
            this.desc = desc;
        }

        public Integer getCode() {
            return code;
        }


        public String getDesc() {
            return desc;
        }
    }

    /**
     * 异常信息处理状态
     */
    public enum HANDLING_STATUS{
        UNTREATED(0, "未处理"),
        PROCESSED(1, "已处理")
        ;

        private Integer code;
        private String desc;

        HANDLING_STATUS(Integer code,String desc){
            this.code = code;
            this.desc = desc;
        }

        public Integer getCode() {
            return code;
        }


        public String getDesc() {
            return desc;
        }
    }

    /**
     * 物流服务商枚举
     */
    public enum logisticsProvidersEnum{
        YOUKE(1,"邮客科技");

        private Integer code;
        private String desc;

        logisticsProvidersEnum(Integer code,String desc){
            this.code = code;
            this.desc = desc;
        }
        public Integer getCode() {
            return code;
        }
        public String getDesc() {
            return desc;
        }
        //枚举列表
        public static List<EnumDto> getLogisticsProvidersEnum(){
            List<EnumDto> list = new ArrayList<>();
            for (OverseasLogisticsEnums.logisticsProvidersEnum e : OverseasLogisticsEnums.logisticsProvidersEnum.values()){
                EnumDto enumDto = new EnumDto();
                enumDto.setCode(e.getCode());
                enumDto.setDesc(e.getDesc());
                list.add(enumDto);
            }
            return list;
        }
    }

    /**
     *
     * 功能描述: 国内快递公司字典
     *
     * @param
     * @return:
     * @auther: Kien
     * @date: 2019/4/28 19:06
     */
    public enum EXPRESSCODE{
        SHUNFENG("shunfeng", "顺丰速运"),
        ZHONGTONG("zhongtong", "中通快递"),
        YUNDA("yunda", "韵达快递"),
        EMS("ems", "EMS"),
        QUANFENGKUAIDI("quanfengkuaidi", "全峰快递"),
        SHENTONG("shentong", "申通快递"),
        YOUZHENGGUOJI("youzhengguoji", "邮政国际"),
        YOUZHENGGUONEI("youzhengguonei", "邮政国内"),
        HUITONGKUAIDI("huitongkuaidi", "百世汇通"),
        JD("jd", "京东快递"),
        DHL("dhl", "DHL"),
        UPS("ups", "UPS"),
        FEDEX("fedex", "Fedex"),
        TNT("tnt", "TNT"),
        TIANTIAN("tiantian", "天天快递"),
        WS("ws", "威盛快递"),
        JAPANPOSTEN("japanposten", "日本邮政"),
        USPS("usps", "USPS"),
        GTS("gts", "GTS"),
        DEBANGWULIU("debangwuliu", "德邦快递")
        ;

        private String code;
        private String desc;
        private static final Map<String, String> map = new HashMap<>();

        static {
            for(OverseasLogisticsEnums.EXPRESSCODE expresscode: OverseasLogisticsEnums.EXPRESSCODE.values()){
                map.put(expresscode.getCode(), expresscode.getDesc());
            }
        }

        EXPRESSCODE(String code,String desc){
            this.code = code;
            this.desc = desc;
        }

        public String getCode() {
            return code;
        }
        public String getDesc() {
            return desc;
        }

        /**
         *
         * 功能描述: 根据code返回msg
         *
         * @param code code码
         * @return:
         * @auther: Kien
         * @date: 2019/4/28 19:20
         */
        public static String getDescByCode(String code){
            if(StringUtils.isBlank(code)){
                return null;
            }
            return map.get(code);
        }
    }


}
